<?php 
	require_once('connect.php');
	$sql = "select * from article order by dateline desc";
	$query = mysql_query($sql);
	if($query&&mysql_num_rows($query)){
		while($row = mysql_fetch_assoc($query)){
			$data[] = $row;
		}
	}
	$page_size=2;
if($data%$page_size==0){
          $maxpage=(int)($row/$page_size);
          
      }else {
          
          $maxpage=(int)($row/$page_size)+1;
      }
      if (isset($_GET['curpage'])){
          $page=$_GET['curpage'];
          
      }else {
          $page=1;
      }
      $start=$page_size*($page-1);
      $get_book_sql="select * from article limit $start,$page_size";
      $result=mysql_query($get_book_sql);
	
 
?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
a{ }
.aaa{ width:1000px; margin: 0 auto; height:1000px;}
.top{ width:100%; background:#FFC; height:100px; border-bottom:#333 solid 1px; text-align:center; line-height:100px; }
.left{ height:900px; width:699px; background:#FFC; float:left; border-right:#333 solid 1px; }
.right{ height:900px; width:300px; float:left; background:#CFF; }
.top h2{ font-size:30px; text-align:center; line-height:100px;}
.list{ margin-top:20px; margin-left:40px;}
.list ul{ list-style:none;}
.list ul li{ line-height:50px; }
.td{ height:50px; width:100px;}
.foot p{ text-align:center; margin-top:10px; width:300px;}
</style>
</head>

<body>

<div class="aaa">
	<!--/*头部*/-->
	<div class="top"><span style="font-size:40px;">首页</span>  <span><a  href="admin/article.manage.php">管理页面</a></span></div>
    
    <!--中间-->
    	<div>
		
    	<div class="left">
        	<div class="list">
            <?php
					foreach($data as $value){		
			?>
            	<div  style="width:500px; margin-left:30px; border-bottom:1px solid #0F9;">
                			<p><span  style="font-size:25px;"><?php echo $value['title'] ?></span>  <span style=" margin-left:30px;">作者：<?php echo $value['author']?></span></p>
          
                  
                    <p><?php echo $value['description'] ?></p>
                    <p> <a href="article.show.php?id=<?php echo $value['id'] ?>">查看详细 >></a>  </p>

                </div>
                <?php
				}
				?>
            </div>
        </div>
        <div class="right" >
      <p style="margin-left:30px;">search</p>
      <form action="article.search.php" method="get">
      <p style="margin-left:30px;"><input type="text"  name="key" /><input type="submit" value="search"  name="x"/></p>
      </form>
      
      
        </div>
    </div>
    
   
    
</div>

</body>
</html>